﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace KingOfCSharp.iHunter
{

    /// <summary>
    /// Represent an attachment file
    /// </summary>
    public class Attachment : IAttachment
    {

        public Attachment(Guid guid, IAttachment source)
        {
            this.Guid = guid;
            this.FileName = source.FileName;
            this.LocalPath = source.LocalPath;
            this.RemoteUrl = source.RemoteUrl;
            this.Size = source.Size;
            this.Description = source.Description;
        }

        /// <summary>
        /// 使用指定的文件名，类型，文件大小，文件引用路径以及描述创建文件对象
        /// </summary>
        /// <param name="filename">文件名</param>
        /// <param name="fileType">文件类型</param>
        /// <param name="fileSize">文件大小</param>
        /// <param name="fileUri">文件引用路径</param>
        /// <param name="description">文件描述</param>
        /// <remarks>
        /// 文件大小为用户指定的大小，该函数不会访问fileUrl去尝试获得真实大小
        /// fileUri可以为本地路径或远程路径
        /// </remarks>
        public Attachment(string filename, string fileType, long fileSize, string fileUri, string description)
        {
            
            this.FileName = filename;
            this.Size = fileSize;
            this.RemoteUrl = fileUri;
            this.LocalPath = "";
            this.Description = (description == null ? "" : description);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Attachment"/> class.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <param name="filename">The filename.</param>
        /// <param name="fileType">Type of the file.</param>
        /// <param name="fileSize">Size of the file.</param>
        /// <param name="fileUri">The file URI.</param>
        /// <param name="localPath">The local path.</param>
        /// <param name="description">The description.</param>
        public Attachment(Guid guid, string filename, string fileType, long fileSize, string fileUri, string localPath, string description)
        {
            this.Guid = guid;
            this.FileName = filename;
            this.Size = fileSize;
            this.RemoteUrl = fileUri;
            this.LocalPath = localPath;
            this.Description = (description == null ? "" : description);
        }


        /// <summary>
        /// GUID
        /// </summary>
        public Guid Guid { get; set; }

        /// <summary>
        /// Gets or sets the name of the file.
        /// </summary>
        /// <value>The name of the file.</value>
        public string FileName { get; set; }
 

        /// <summary>
        /// 文件大小 
        /// </summary>
        public long Size { get; set; }


        /// <summary>
        /// Gets or sets the remote URL.
        /// </summary>
        /// <value>The remote URL.</value>
        public string RemoteUrl { get; set; }

        /// <summary>
        /// Gets or sets the local path.
        /// </summary>
        /// <value>The local path.</value>
        public string LocalPath
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the description of the attachment file.
        /// </summary>
        /// <value>The description.</value>
        public string Description
        {
            get;
            set;
        }

    }
}
